package cn.edu.lingnan.lsqn.model;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "t_candidate")
public class Candidate {
	private int id;
	private String name;
	private String department;
	private long totalVote;
	private CandidateType candidateType;

	public Candidate() {
	}
	
	public Candidate(int id, String name, String department, CandidateType candidateType) {
		this.id = id;
		this.name = name;
		this.department = department;
		this.totalVote = 0;
		this.candidateType = candidateType;
	}

	@Id
	@GeneratedValue
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDepartment() {
		return department;
	}

	public void setDepartment(String department) {
		this.department = department;
	}

	@ManyToOne
	@JoinColumn(name="cType_id")
	public CandidateType getCandidateType() {
		return candidateType;
	}

	public void setCandidateType(CandidateType candidateType) {
		this.candidateType = candidateType;
	}

	public long getTotalVote() {
		return totalVote;
	}

	public void setTotalVote(long totalVote) {
		this.totalVote = totalVote;
	}
}
